package com.ean.backpack.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ean.backpack.domain.Attributelist;
import com.ean.backpack.repository.AttributelistRepository;
import com.ean.backpack.service.AttributelistService;

@Service
@Transactional
public class AttributelistServiceImpl implements AttributelistService {

	@Autowired
	AttributelistRepository attributelistRepository;

	public long countAllAttributelists() {
		return attributelistRepository.count();
	}

	public void deleteAttributelist(Attributelist attributelist) {
		attributelistRepository.delete(attributelist);
	}

	public Attributelist findAttributelist(Integer id) {
		return attributelistRepository.findOne(id);
	}

	public List<Attributelist> findAllAttributelists() {
		return attributelistRepository.findAll();
	}

	public List<Attributelist> findAttributelistEntries(int firstResult,
			int maxResults) {
		return attributelistRepository.findAll(
				new org.springframework.data.domain.PageRequest(firstResult
						/ maxResults, maxResults)).getContent();
	}

	public void saveAttributelist(Attributelist attributelist) {
		attributelistRepository.save(attributelist);
	}

	public Attributelist updateAttributelist(Attributelist attributelist) {
		return attributelistRepository.save(attributelist);
	}
}
